import Vue from 'vue'
import App from './App'
import router from './router'
import axios from 'axios'
import ElementUI from 'element-ui'
// 导入图标字体
import './assets/fonts/iconfont.css'
// 导入全局样式表
import './assets/css/base.css'
Vue.use(ElementUI)
axios.defaults.baseURL = 'https://www.escook.cn:8888/api/private/v1/'
// 除了登陆页面都要携带一个token，挂在到拦截器上
axios.interceptors.request.use(config => {
  // 通过拦截request请求，给请求头追加新属性Authorization,把token的值赋给此属性
  config.headers['Authorization'] = window.sessionStorage.getItem('token')
  return config
})
Vue.prototype.$http = axios

Vue.config.productionTip = false

/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  render: h => h(App)
})
